Bug 503071 - Application direction changes to right to left even if theres
author14:27:34 Tim Janik <timj@imendio.com>
Tue, 20 May 2008 13:03:41 +0000 (13:03 +0000)
committerTim Janik <timj@src.gnome.org>
Tue, 20 May 2008 13:03:41 +0000 (13:03 +0000)
2008-05-20 14:27:34  Tim Janik  <timj@imendio.com>

        * reverted recent unapproved changes by Yair Hershkovitz, regarding:
        Bug 503071 - Application direction changes to right to left even if theres no translation.

svn path=/trunk/; revision=20116

ChangeLog
gtk/gtkaccellabel.c
gtk/gtkactiongroup.c
gtk/gtkbuilderparser.c
gtk/gtkimmulticontext.c
gtk/gtkintl.h
gtk/gtkmain.c
gtk/gtkstock.c

index 8e8414ce3e11871e9d4710614c695000d378429d..68e59ac1d6c7953bae143ed312a849028eaa8c2e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-05-20 14:27:34  Tim Janik  <timj@imendio.com>
+
+       * reverted recent unapproved changes by Yair Hershkovitz, regarding:
+       Bug 503071 – Application direction changes to right to left even if theres no translation.
+
 2008-05-19  Richard Hult  <richard@imendio.com>
 
        * gdk/quartz/gdkwindow-quartz.c: (gdk_window_hide),
index dbb657f23d89b9c2b7a221999ad39ec98c0059bc..6a7bf1eda5ca3c7a305c29b1f18e66a8d6c122ee 100644 (file)
@@ -646,7 +646,7 @@ _gtk_accel_label_class_get_accelerator_label (GtkAccelLabelClass *klass,
              
              strcpy (msg, "keyboard label|");
              g_strlcat (msg, tmp, 128);
-             str = g_dgettext (GETTEXT_PACKAGE, msg);
+             str = dgettext (GETTEXT_PACKAGE, msg);
              if (str == msg)
                {
                  g_string_append (gstring, tmp);
index 6f085ee0dc1b649a7a13dd8f18ae41a15c2dea15..3a864649504709e7a14aecb9af15811c308fcfc5 100644 (file)
@@ -1280,7 +1280,7 @@ dgettext_swapped (const gchar *msgid,
 {
   /* Pass through dgettext if and only if msgid is nonempty. */
   if (msgid && *msgid) 
-    return g_dgettext (domainname, msgid); 
+    return dgettext (domainname, msgid); 
   else
     return (gchar*) msgid;
 }
index 62e2059636441a3e408eb7cd64bfc5b0a1332ad7..15fbae3a3dbc0c24ffdfe8da01b0d4e10412073a 100644 (file)
@@ -755,10 +755,13 @@ start_element (GMarkupParseContext *context,
                   element_name);
 }
 
+/* This function is taken from gettext.h 
+ * GNU gettext uses '\004' to separate context and msgid in .mo files.
+ */
 static const char *
-_g_dpgettext (const char *domain,
-              const char *msgctxt,
-              const char *msgid)
+dpgettext (const char *domain,
+           const char *msgctxt,
+           const char *msgid)
 {
   size_t msgctxt_len = strlen (msgctxt) + 1;
   size_t msgid_len = strlen (msgid) + 1;
@@ -768,10 +771,22 @@ _g_dpgettext (const char *domain,
   msg_ctxt_id = g_alloca (msgctxt_len + msgid_len);
   
   memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
-  msg_ctxt_id[msgctxt_len - 1] = '|';
+  msg_ctxt_id[msgctxt_len - 1] = '\004';
   memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
 
-  return g_dpgettext (domain, msg_ctxt_id, 0);
+  translation = dgettext (domain, msg_ctxt_id);
+
+  if (translation == msg_ctxt_id) 
+    {
+      /* try the old way of doing message contexts, too */
+      msg_ctxt_id[msgctxt_len - 1] = '|';
+      translation = dgettext (domain, msg_ctxt_id);
+  
+      if (translation == msg_ctxt_id)
+        return msgid;
+    }
+  return translation;
 }
 
 gchar *
@@ -782,9 +797,9 @@ _gtk_builder_parser_translate (const gchar *domain,
   const char *s;
 
   if (context)
-    s = _g_dpgettext (domain, context, text);
+    s = dpgettext (domain, context, text);
   else
-    s = g_dgettext (domain, text);
+    s = dgettext (domain, text);
 
   return g_strdup (s);
 }
index 3ee0cc565fbce9cb3bfd3185a6c3f2d6007874a9..484ae51e6da3e0ce4a1edad6d39eb9f1eb4ab280 100644 (file)
@@ -590,7 +590,7 @@ gtk_im_multicontext_append_menuitems (GtkIMMulticontext *context,
 #ifdef HAVE_BIND_TEXTDOMAIN_CODESET
              bind_textdomain_codeset (contexts[i]->domain, "UTF-8");
 #endif
-             translated_name = g_dgettext (contexts[i]->domain, contexts[i]->context_name);
+             translated_name = dgettext (contexts[i]->domain, contexts[i]->context_name);
            }
          else
            {
index caeb68eb6019a6f9920986a972e5a83b306b8de6..4b176bd9f64c8a3300d0b4523357d29e630ce654 100644 (file)
@@ -4,7 +4,7 @@
 #include <glib/gi18n-lib.h>
 
 #ifdef ENABLE_NLS
-#define P_(String) g_dgettext(GETTEXT_PACKAGE "-properties",String)
+#define P_(String) dgettext(GETTEXT_PACKAGE "-properties",String)
 #else 
 #define P_(String) (String)
 #endif
index a8352243987993cf443a9f4fe28882248d6e865a..e8f386751b8016772f72353da21cc8b2f37b0534 100644 (file)
@@ -177,7 +177,6 @@ const guint gtk_interface_age = GTK_INTERFACE_AGE;
 static guint gtk_main_loop_level = 0;
 static gint pre_initialized = FALSE;
 static gint gtk_initialized = FALSE;
-static gint gettext_initialized = FALSE;
 static GList *current_events = NULL;
 
 static GSList *main_loops = NULL;      /* stack of currently executing main loops */
@@ -374,8 +373,6 @@ gtk_disable_setlocale (void)
     g_warning ("gtk_disable_setlocale() must be called before gtk_init()");
     
   do_setlocale = FALSE;
-
-  g_disable_setlocale ();
 }
 
 #ifdef G_PLATFORM_WIN32
@@ -633,10 +630,6 @@ do_pre_parse_initialization (int    *argc,
 static void
 gettext_initialization (void)
 {
-  if (gettext_initialized)
-    return;
-  gettext_initialized = TRUE;
-
 #ifdef ENABLE_NLS
   bindtextdomain (GETTEXT_PACKAGE, GTK_LOCALEDIR);
   bindtextdomain (GETTEXT_PACKAGE "-properties", GTK_LOCALEDIR);
@@ -644,7 +637,6 @@ gettext_initialization (void)
   bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
   bind_textdomain_codeset (GETTEXT_PACKAGE "-properties", "UTF-8");
 #    endif
-  g_i18n_init ();
 #endif  
 }
 
index c649be6277bcfafc622349c71c69ca39cfefa618..c50cf9a23660f6861d9db6277f1756bedf13143d 100644 (file)
@@ -176,7 +176,7 @@ gtk_stock_lookup (const gchar  *stock_id,
          if (translate != NULL && translate->func != NULL)
            item->label = (* translate->func) (item->label, translate->data);
          else
-           item->label = g_dgettext (item->translation_domain, item->label);
+           item->label = dgettext (item->translation_domain, item->label);
        }
     }
 
@@ -457,7 +457,7 @@ sgettext_swapped (const gchar *msgid,
 {
   gchar *domainname = data;
 
-  return (gchar *)g_strip_context (msgid, g_dgettext (domainname, msgid));
+  return (gchar *)g_strip_context (msgid, dgettext (domainname, msgid));
 }